<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/6/19 0019
 * Time: 9:05
 */
if ($_SERVER["REQUEST_METHOD"]=="GET"){
    $result=array("msg"=>"不支持get请求","status"=>-1);
    print_r(json_encode($result));
    return ;
};
if (!(isset($_POST["utelphone"])&&isset($_POST["utelphone"]))){
    $result=array("msg"=>"参数不合法","status"=>-2);
    print_r(json_encode($result));
    return ;
};
$utelphone=$_POST["utelphone"];
$upwd=$_POST["upwd"];
//1.创建数据库的连接对象
$conn=new mysqli("127.0.0.1","root","","fsgouwu","3306");
//2.设置链接字符集
mysqli_query($conn,"set names utf8");
//3.准备sql语句
$sql="INSERT INTO `userinfo` (`u_telphone`,`u_pwd`) VALUES ('".$utelphone."','".$upwd."')";
//4.执行sql语句
$resultData=$conn->query($sql);
//5.判断结果
if ($resultData==1){
    $result=array("msg"=>"注册成功","status"=>1);
    print_r(json_encode($result));
}else{
    $result=array("msg"=>"注册失败","status"=>-3);
    print_r(json_encode($result));
}
//6.关闭数据库链接
$conn->close();